
#include "cocos-ext.h"

#include "MainMenuScene.h"
#include "StageSelectScene.h"


USING_NS_CC;
USING_NS_CC_EXT;

MainMenuScene::MainMenuScene(bool bPortrait )
{
    CCScene::init();
}

void MainMenuScene::onEnter()
{
    CCScene::onEnter();


	UILayer* ul =UILayer::create();
	ul->addWidget(CCUIHELPER->createWidgetFromJsonFile("UI/MainMenu.json"));
    addChild(ul, 1);

	UIButton* playBtn = (UIButton*)ul->getWidgetByTag(27);
	playBtn->addReleaseEvent(this, menu_selector(MainMenuScene::PlayCallback) );



}

// The CallBack for back to the main menu scene
void MainMenuScene::BackCallback(CCObject* pSender)
{
}



void MainMenuScene::PlayCallback(CCObject* pSender)
{
	StageSelectScene* selectScn = new StageSelectScene;
	CCDirector::sharedDirector()->replaceScene(CCTransitionFade::create(1,selectScn ));
}